//
//  KKButton.m
//  button
//
//  Created by MasterLing on 2017/10/10.
//  Copyright © 2017年 PandaProTool. All rights reserved.
//

#import "KKButton.h"

#define lineWidth 1.5

@implementation KKButton


// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
    
    CGFloat width = rect.size.width;
    CGFloat height = rect.size.height;
    //获取上下文 上下文的输出目标就是self[view]
    CGContextRef context = UIGraphicsGetCurrentContext();
    // 设置线颜色
    CGContextSetRGBStrokeColor(context, 255/255.0, 255/255.0, 255/255.0, 1);
    // 设置线宽
    CGContextSetLineWidth(context, lineWidth);
    //设置一起点
    CGContextMoveToPoint(context, width-lineWidth, lineWidth);
    CGContextAddLineToPoint(context, height/2+lineWidth, lineWidth);
    CGContextAddArc(context, height/2+lineWidth, height/2, height/2-lineWidth, -M_PI_2, M_PI_2, 1);
    CGContextAddLineToPoint(context, width-lineWidth, height-lineWidth);
    //只是画一条，【空心】
    CGContextStrokePath(context);
}

@end
